<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<table cellspacing="0" cellpadding="0" class='compare_table'>
<?

$add_fields = $this->db->select()->from('catalog_parents')->where('parent_id', $items[0]['item_parent'])->get()->row_array();

$bigbook[0][0] = "";
$bigbook[1][0] = "Категория:";
$bigbook[2][0] = "Название:";
$bigbook[3][0] = "Бренд:";
$bigbook[4][0] = "Фото:";
$bigbook[5][0] = "Стоимость:";
$bigbook[6][0] = ($add_fields['parent_custom_field_1']?$add_fields['parent_custom_field_1'].":":"Параметр 1:");
$bigbook[7][0] = ($add_fields['parent_custom_field_2']?$add_fields['parent_custom_field_2'].":":"Параметр 2:");
$bigbook[8][0] = ($add_fields['parent_custom_field_3']?$add_fields['parent_custom_field_3'].":":"Параметр 3:");
$bigbook[9][0] = ($add_fields['parent_custom_field_4']?$add_fields['parent_custom_field_4'].":":"Параметр 4:");
$bigbook[10][0] = ($add_fields['parent_custom_field_5']?$add_fields['parent_custom_field_5'].":":"Параметр 5:");
$bigbook[11][0] = ($add_fields['parent_custom_field_6']?$add_fields['parent_custom_field_6'].":":"Параметр 6:");
$bigbook[12][0] = ($add_fields['parent_custom_field_7']?$add_fields['parent_custom_field_7'].":":"Параметр 7:");
$bigbook[13][0] = ($add_fields['parent_custom_field_8']?$add_fields['parent_custom_field_8'].":":"Параметр 8:");
$bigbook[14][0] = "Описание";
$bigbook[15][0] = "";

$k = 0;
		foreach($items as $item){
			$k++;
			$brand = $this->db->select('brand_title, brand_id')->from('catalog_brands')->where('brand_id',$item['item_brand'])->limit(1)->get()->row_array();
			$parent = $this->db->select('parent_title, parent_id')->from('catalog_parents')->where('parent_id',$item['item_parent'])->limit(1)->get()->row_array();
			$image = $this->db->select()->from('catalog_images')->where('photo_item', $item['item_id'])->where('photo_main', 1)->limit(1)->get()->row_array();
			if(sizeof($image) <= 0){
				$image = $this->db->select()->from('catalog_images')->where('photo_item', $item['item_id'])->limit(1)->get()->row_array();
			}
			$bigbook[0][$k] = "<a class='compare_del' href='/basket/deletecompare/".$item['item_id']."/'>удалить из сравнения</a>";
			$bigbook[1][$k] = "<a href='/catalog/category/".$parent['parent_id']."/'>".$parent['parent_title']."</a>";
			$bigbook[2][$k] = "<a href='/catalog/".$item['item_id']."/'>".$item['item_title']."</a>";
			$bigbook[3][$k] = "<a href='/brands/".$brand['brand_id']."/'>".$brand['brand_title']."</a>";
			$bigbook[4][$k] = "<div><img src='/uploads/catalog_items/".$item["item_id"]."/small/".$image["photo_file"]."' /></div>";
			$bigbook[5][$k] = $item['item_price']." руб.";
			$bigbook[6][$k] = $item['item_custom_field_1'];
			$bigbook[7][$k] = $item['item_custom_field_2'];
			$bigbook[8][$k] = $item['item_custom_field_3'];
			$bigbook[9][$k] = $item['item_custom_field_4'];
			$bigbook[10][$k] = $item['item_custom_field_5'];
			$bigbook[11][$k] = $item['item_custom_field_6'];
			$bigbook[12][$k] = $item['item_custom_field_7'];
			$bigbook[13][$k] = $item['item_custom_field_8'];
			$bigbook[14][$k] = $item['item_compare'];
			$bigbook[15][$k] = "<a href='#' rel='".$page['item_id']."' class='addtobasket'>В корзину</a>";
		}
for ($i = 0; $i <= 15; $i++) {
	echo "<tr>";

		for ($j = 0; $j <= sizeof($items); $j++) {
			echo "<td class='".($i==14?"desc":"")."'>";
				echo $bigbook[$i][$j];
			echo "</td>";
		}
	echo "</tr>";
}

/*



	if(sizeof($items) > 0){
		foreach($items as $item){
			$brand = $this->db->select('brand_title, brand_id')->from('catalog_brands')->where('brand_id',$item['item_brand'])->limit(1)->get()->row_array();
			$parent = $this->db->select('parent_title, parent_id')->from('catalog_parents')->where('parent_id',$item['item_parent'])->limit(1)->get()->row_array();
			$image = $this->db->select()->from('catalog_images')->where('photo_item', $item['item_id'])->where('photo_main', 1)->limit(1)->get()->row_array();
			if(sizeof($image) <= 0){
				$image = $this->db->select()->from('catalog_images')->where('photo_item', $item['item_id'])->limit(1)->get()->row_array();
			}
			echo "<tr>";
				echo "<td class='odd'>";
					echo "<a class='compare_del' href='/basket/deletecompare/".$item['item_id']."/'>удалить из сравнения</a>";
				echo "</td>";
				echo "<td class='even'>";
					echo "<a href='/catalog/category/".$parent['parent_id']."/'>".$parent['parent_title']."</a>";
				echo "</td>";
				echo "<td class='odd'>";
					echo "<a href='/catalog/".$item['item_id']."/'>".$item['item_title']."</a>";
				echo "</td>";
				echo "<td class='even'>";
					echo "<a href='/brands/".$brand['brand_id']."/'>".$brand['brand_title']."</a>";
				echo "</td>";
				echo "<td class='photo odd'>";
					echo "<div><img src='/uploads/catalog_items/".$item["item_id"]."/small/".$image["photo_file"]."' /></div>";
				echo "</td>";
				echo "<td class='price even'>";
					echo $item['item_price']." руб.";
				echo "</td>";
				for($i=1;$i<=8;$i++){
					echo "<td class='".((($i+6)%2)==0?'even':'odd')."'>";
						echo $item['item_custom_field_'.$i];
					echo "</td>";
				}
				echo "<td class='desc odd'>";
					echo $item['item_compare'];
				echo "</td>";
				echo "<td class='even'>";
					echo "<a style='float: left;' href='#' rel='".$page['item_id']."' class='addtobasket'>В корзину</a>";
				echo "</td>";
			echo "</tr>";
		}
	}
 *
 */
?>
</table>
<a href='/basket/clearcompare/'>Очистить сравнение</a>